package org.meetunexpectedly.service.login;

import org.meetunexpectedly.entity.vo.Captcha;
import org.meetunexpectedly.entity.user.User;
import org.meetunexpectedly.entity.vo.ForgotPwdVO;
import org.meetunexpectedly.entity.vo.RegisterVO;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description: 登录服务接口
 * @Author: pupil
 * @Date: 2024/08/03 下午 9:23
 */
public interface LoginService {

    /**
     * 登录
     *
     * @param user 用户
     * @return
     */
    User login(User user);


    /**
     * 获取图形验证码
     *
     * @param response
     * @param uuId
     * @throws IOException
     */
    void getCaptcha(HttpServletResponse response, String uuId) throws IOException;


    /**
     * 获取邮箱验证码
     *
     * @param captcha
     * @param captcha 图形验证码
     * @return
     * @throws Exception
     */
    Boolean getCode(Captcha captcha) throws Exception;

    /**
     * 检查邮箱验证码
     *
     * @param email 邮箱
     * @param code  图形验证码
     * @return
     */
    Boolean checkCode(String email, Integer code);

    /**
     * 注册账号
     * @param registerVO 注册信息
     * @return
     * @throws Exception
     */
    Boolean register(RegisterVO registerVO) throws Exception;

    /**
     * 忘记密码
     * @param forgotPwdVO 密码重置信息
     * @return
     */
    Boolean forgotPassword(ForgotPwdVO forgotPwdVO);
}
